package course.mystream;

import java.util.ArrayList;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class MyStream5 {
    public static void main(String[] args) {
        ArrayList<String>   manList = new ArrayList<>();
        manList.add("张国立");
        manList.add("张晋");
        manList.add("刘华");
        manList.add("郑伊健");
        manList.add("徐峥");
        manList.add("王宝强");

        ArrayList<String> womanList = new ArrayList<>();
        womanList.add("郑爽");
        womanList.add("杨紫");
        womanList.add("关晓彤");
        womanList.add("张天爱");
        womanList.add("杨幂");
        womanList.add("赵丽颖");

        //男演员只要名字为3个字的前两人
        Stream<String> s1 = manList.stream().filter(s->s.length()==3).limit(2);

        //女演员只要姓杨的，且不要第一个
        Stream<String> s2 = womanList.stream().filter(s->s.startsWith("杨")).skip(1);

        //合并
        Stream.concat(s1,s2).forEach(name->{
            Actor act = new Actor(name);
            System.out.println(act);
        });
    }
}
